package com.spring.camel.project;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.jms.JmsComponent;
import org.apache.camel.impl.DefaultCamelContext;

import javax.jms.ConnectionFactory;

public class CamelActivemq {
    public static void main(String[] args) throws Exception {
        CamelContext camelContext = new DefaultCamelContext();
        ConnectionFactory connect = new ActiveMQConnectionFactory();
        camelContext.addComponent("jms", JmsComponent.jmsComponentAutoAcknowledge(connect));
        camelContext.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                from("file:C:\\Users\\nick\\Desktop\\file?noop=true")
                        .to("activemq:queue:my_que");
            }
        });
        while (true)
            camelContext.start();
    }
}
